/**
 * 
 */
package me.bianbian.test.taobao;

import java.io.File;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.remote.DesiredCapabilities;

/**
 * @author mbian
 * 
 */
public class TaobaoRobot {

	public static void main(String args[]) {
		ChromeDriverService service = new ChromeDriverService.Builder()
				.usingChromeDriverExecutable(
						new File(
								"U:/development/workspace-sts-2.8.0.RELEASE/lib/chromedriver.exe"))
				.usingAnyFreePort().build();
		DesiredCapabilities capabilities = DesiredCapabilities.chrome();
		capabilities
				.setCapability(
						"chrome.binary",
						"C:/Documents and Settings/mbian/Local Settings/Application Data/Google/Chrome/Application/chrome.exe");

		WebDriver driver = new ChromeDriver(service, capabilities);
		while (true) {
			driver.get("http://msp.m.taobao.com/awd/award.htm?sid=c9fc78551fcdf107c73254e92ae50d9a&aid=5");
			driver.findElement(
					By.cssSelector("input[name='event_submit_do_award']"))
					.click();
			driver.findElement(By.cssSelector("p.red>a")).click();
		}

		// driver.quit();
	}

}
